/**
 * @desc hello2
 */

import * as defs from '../../baseClass';
import { PontCore } from '../../pontCore';
import { BACKEND_URL } from '../../../constants';
import { getToken } from '@/utils/auth';
import { toastFail } from '@/utils/toast';
export class Params {
  /** title */
  title?: string;
  /** author */
  author?: string;
}

export const init = '';

export const request = async (params: Params, options?: any) => {
  options = options || {};
  const accessToken = await getToken();
  options.headers = {
    accessToken,
  };

  try {
    const result = await PontCore.fetch(
      PontCore.getUrl(`${BACKEND_URL}/v1/test/hello2`, params, 'GET'),
      {
        method: 'GET',

        ...options,
      },
    );
    if (!result || !result.success) {
      if (!options?.hideError) {
        console.warn(result?.message || '获取数据失败');
      }
      return undefined;
    }
    return result.data;
  } catch (ex) {
    console.warn('获取数据失败');
  }
};
